import os
import configparser

from utils.loggerManager import create_logger



base_path = os.path.dirname(os.path.abspath(__file__))

config = configparser.ConfigParser()

config.read(os.path.join(base_path, 'config.ini'))

pythonEnv = config.get('pythonEnv', 'path')
HOST = config.get('service', 'host')

PORT = config.get('service', 'port')

managerPath = os.path.join(base_path, 'manage.py')


# MYSQL

MYSQL_HOST = config.get('mysql', 'host')

MYSQL_PORT = int(config.get('mysql', 'port'))

MYSQL_USER = config.get('mysql', 'user')

MYSQL_PASSWORD = config.get('mysql', 'password')

MYSQL_DB = config.get('mysql', 'db')


# ES

ES_HOST = eval(config.get('elasticsearch', 'host'))


ALLOW = eval(config.get('allow', 'allow'))


# JWT

JWT_NOISE = config.get('JWT', 'noise')


# 存放用户文件的地方

UPLOAD_FILES_DIRS = config.get('user_static', 'user_static')


# redis

REDIS_HOST = config.get('my_redis', 'host')

REDIS_PORT = config.get('my_redis', 'port')

REDIS_PASSWORD = config.get('my_redis', 'password')


# email_serve

EMAIL_SERVE_HOST = config.get('email_serve', 'host')

EMAIL_SERVE_PASS = config.get('email_serve', 'pass')

LOG = create_logger("bws", "bws.log")

